#ifndef MDIO_REG_WR_HPP_



	typedef union	msg_mdio_u
	{
		struct __attribute__((packed, aligned(1)))
		{
			unsigned     	start		:2;
			unsigned		opcode		:2;
			unsigned		phy_addr	:5;
			unsigned		reg_addr	:5;
			unsigned		ta			:2;
			unsigned		reg_data	:16;
		};
		unsigned	data;
	}msg_mdio_t;



//! Структура заголовка IP
	typedef union	reg0_u
	{
		struct __attribute__((packed, aligned(1)))
		{
			unsigned reset			:1;
			unsigned loopback		:1;
			unsigned speed0			:1;
			unsigned an_ena			:1;
			unsigned power_down		:1;
			unsigned isolate		:1;
			unsigned restart		:1;
			unsigned duplex_mode	:1;
			unsigned col_test		:1;
			unsigned speed1			:1;
			unsigned res			:6;
		};
		alt_u16	data;
	} reg0_t;

//! Структура заголовка IP
	typedef union	reg16_u
	{
		struct __attribute__((packed, aligned(1)))
		{
			unsigned tx_fifo_depth	:2;
			unsigned rx_fifo_depth	:2;
			unsigned crs_mode		:1;
			unsigned forse_link_good:1;
			unsigned energy_detect	:2;
			unsigned ext_dist		:1;
			unsigned cross_mode		:2;
			unsigned dsbl_125clk	:1;
			unsigned mac_pow_down	:1;
			unsigned sqe_test		:1;
			unsigned polarity		:1;
			unsigned dis_jubber		:1;
		};
		alt_u16	data;
	} reg16_t;

	alt_u8 mdio_reg_wr(alt_u8 phy_addr, alt_u8 reg_addr, alt_u16 reg_data);


#endif /* MDIO_REG_WR_HPP_ */
